
<?php 
  	require "Controller.php";
 	require "Model/userModel.php";
	 class userController extends Controller
	 {
	 	//private $mod;

	 	function __construct()
	 	{
	 		parent::__construct();
	 		$this->mod = new userModel();
	 		//$mod = "user";
	 	}
	 	public function listusers()
	 	{
	 		
	 		$userdata=$this->mod->getUserList();

	 		//$userdata2=$this->mod->getUserList2();

	 		$this -> assign("user",$userdata);

	 		//$this -> assign("users2",$userdata2);


	 		$this -> display();
	 	

	 }
   //修改用户信息
      public function edituser(){
        $data=$this->mod->getUserbyID();
        $this->assign('user',$data);
        $this->display();

      }
      public function updateuser(){
        $result=$this->mod->updateUserInfo();
        if($result==true){
          echo '更新成功！<br>';
          header("refresh:3;index.php?c=user&m=listusers");
          echo ' <a href="index.php?c=user&m=listusers">如果没有跳转，请点这里跳转</a>';
        }

      }
      public function deluser(){
        $result=$this->mod->delUserInfo();
        if($result==true){
          echo '更新成功！<br>';
          header("refresh:3;index.php?c=user&m=listusers");
          echo ' <a href="index.php?c=user&m=listusers">如果没有跳转，请点这里跳转</a>';
        }

      }
	}

 ?>